//
//  YQMallVC.m
//  NewRetail
//
//  Created by yuqin on 2019/6/21.
//  Copyright © 2019 yuqin. All rights reserved.
//

#import "YQMallVC.h"
#import "YQMallCell.h"

@interface YQMallVC ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *marketPriceTB;//市场价
@property (nonatomic, strong) UITableView *WholesaleDistrictTB;//批发价
@property (nonatomic, strong) NSMutableArray *rowArr;
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *sectionArr;

@end

@implementation YQMallVC

- (NSMutableArray *)rowArr {
    if (!_rowArr) {
        _rowArr = [NSMutableArray array];
    }
    return _rowArr;
}

- (NSMutableArray<NSDictionary *> *)sectionArr {
    if (!_sectionArr) {
        _sectionArr = [NSMutableArray array];
    }
    return _sectionArr;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.txtTitle.text = @"市价区";
    [self setupMallView];
    [self loadTableViewData];
}

- (void)loadTableViewData {
    
}

- (void)setupMallView {
    CGFloat tableViewHeight = (ScreenHeight-NavigationStatusBarHeight-FIT(45))/2.0;
    for (NSInteger i = 0; i < 2; i++) {
        UITableView *tb = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
        tb.delegate=self;
        tb.dataSource=self;
        tb.backgroundColor = TableViewBackGroundColor;
        [tb registerClass:[YQMallCell class] forCellReuseIdentifier:MALL_Cell];
        [self.view addSubview:tb];
        if (i == 0) {
            self.marketPriceTB = tb;
            self.marketPriceTB.frame = CGRectMake(0, NavigationStatusBarHeight, ScreenWidth, tableViewHeight);
        }else {
            self.WholesaleDistrictTB = tb;
            //创建一个头
            UIImageView *backImageView = [[UIImageView alloc] init];
            backImageView.image = YQ_IMAGE(@"navgationBar");
            [self.view addSubview:backImageView];
            [backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(0);
                make.top.equalTo(self.marketPriceTB.mas_bottom).mas_equalTo(0);
                make.size.mas_equalTo(CGSizeMake(ScreenWidth, FIT(45)));
            }];
            [backImageView LX_SetShadowPathWith:UIColorFromRGB(0xeeeeee) shadowOpacity:5 shadowRadius:2 shadowSide:LXShadowPathTop shadowPathWidth:5];
            UILabel *theTitleLab = [YQViewFactory labelWithTextColor:WhiteColor textAlignment:NSTextAlignmentCenter fontSize:FIT(18) userBold:YES];
            theTitleLab.text = @"批发区";
            [backImageView addSubview:theTitleLab];
            [theTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
                make.edges.mas_equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
            }];
            [self.WholesaleDistrictTB mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(0);
                make.top.equalTo(theTitleLab.mas_bottom).mas_equalTo(0);
                make.size.mas_equalTo(CGSizeMake(ScreenWidth, tableViewHeight-FIT(45)-Botoom_IPhoneX));
            }];
        }
    }
    
}

#pragma mark - delegate /DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//    return self.sectionArr.count;
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//    return [self.sectionArr[section] count];
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return YQMallCellHeight;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    YQMallCell *cell = [tableView dequeueReusableCellWithIdentifier:MALL_Cell forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
}

@end
